#!/bin/bash

function env_public() {
  cat <<EOL
###################### public start #####################
DIR_MACHINE_WWW=./www/
DIR_CONTAINER_WWW=/\${ROOT_DIR_NAME}/www/
DIR_MACHINE_LOGS=./logs/
DIR_CONTAINER_LOGS=/\${ROOT_DIR_NAME}/logs/
MACHINE_LOCALTIME=./etc/localtime
CONTAINER_LOCALTIME=/etc/localtime
MACHINE_TIMEZONE=./etc/timezone
CONTAINER_TIMEZONE=/etc/timezone
MACHINE_PASSWD=/etc/passwd
CONTAINER_PASSWD=/etc/passwd
MACHINE_GROUP=/etc/group
CONTAINER_GROUP=/etc/group
ALPINE_VERSION=\${ALPINE_VERSION}
ALPINE_REPOSITORIES=mirrors.aliyun.com
###################### public end #######################

EOL
}

function env_nginx() {
  cat <<EOL
###################### nginx start ######################
NGINX_MACHINE_HTTP_PORT=80
NGINX_CONTAINER_HTTP_PORT=80
NGINX_MACHINE_HTTPS_PORT=443
NGINX_CONTAINER_HTTPS_PORT=443
NGINX_MACHINE_CONFIG=./conf/nginx.conf
NGINX_CONTAINER_CONFIG=/etc/nginx/nginx.conf
NGINX_MACHINE_CERTS=./certs/
NGINX_CONTAINER_CERTS=/\${ROOT_DIR_NAME}/certs/
NGINX_MACHINE_VHOSTS=./vhosts/
NGINX_CONTAINER_VHOSTS=/\${ROOT_DIR_NAME}/vhosts/
###################### nginx end ########################
EOL
}

function env_mysql_8.0.16() {
  cat <<EOL
###################### mysql start ######################
MYSQL_VERSION=8.0.16
MYSQL_MACHINE_PORT=3306
MYSQL_CONTAINER_PORT=3306
MYSQL_MACHINE_CONFIG=./conf/mysql.cnf
MYSQL_CONTAINER_CONFIG=/etc/mysql/conf.d/mysql.cnf
MYSQL_MACHINE_DATA=./mysql/
MYSQL_CONTAINER_DATA=/var/lib/mysql/
MYSQL_PASSWORD=\${MYSQL_PASSWORD}
MYSQL_PERCONA_XTRABACKUP_VERSION=80_8.0.14-1
###################### mysql end ########################
EOL
}

function env_mysql_latest() {
  cat <<EOL
###################### mysql start ######################
MYSQL_VERSION=latest
MYSQL_MACHINE_PORT=3306
MYSQL_CONTAINER_PORT=3306
MYSQL_MACHINE_CONFIG=./conf/mysql.cnf
MYSQL_CONTAINER_CONFIG=/etc/mysql/conf.d/mysql.cnf
MYSQL_MACHINE_DATA=./mysql/
MYSQL_CONTAINER_DATA=/var/lib/mysql/
MYSQL_PASSWORD=\${MYSQL_PASSWORD}
MYSQL_PERCONA_XTRABACKUP_VERSION=80_8.0.14-1
###################### mysql end ########################
EOL
}

function env_mongo() {
  cat <<EOL
###################### mongo start ######################
MONGO_MACHINE_PORT=27017
MONGO_CONTAINER_PORT=27017
MONGO_MACHINE_CONFIG=./conf/mongod.conf
MONGO_CONTAINER_CONFIG=/etc/mongod.conf
MONGO_MACHINE_DATA=./mongo/
MONGO_CONTAINER_DATA=/data/db
MONGO_ENTRYPOINT=/bin/sh -c 'mongod --config /etc/mongod.conf'
######################mongo end########################
EOL
}

function env_redis() {
  cat <<EOL
###################### redis start ######################
REDIS_MACHINE_PORT=6379
REDIS_CONTAINER_PORT=6379
REDIS_MACHINE_CONFIG=./conf/redis.conf
REDIS_CONTAINER_CONFIG=/etc/redis/redis.conf
REDIS_MACHINE_DATA=./redis/
REDIS_CONTAINER_DATA=/data/
REDIS_ENTRYPOINT=/bin/sh -c 'redis-server /etc/redis/redis.conf'
REDIS_SYSCTLS_NET_CORE_SOMAXCONN=511
######################redis end########################
EOL
}

function env_rabbitmq() {
  cat <<EOL
###################### rabbitmq start ###################
RABBITMQ_MACHINE_PORT=5672
RABBITMQ_CONTAINER_PORT=5672
RABBITMQ_MACHINE_MANAGEMENT_PORT=15672
RABBITMQ_CONTAINER_MANAGEMENT_PORT=15672
RABBITMQ_MACHINE_CONFIG=./conf/rabbitmq.config
RABBITMQ_CONTAINER_CONFIG=/etc/rabbitmq/rabbitmq.conf
RABBITMQ_MACHINE_DATA=./rabbitmq/
RABBITMQ_CONTAINER_DATA=/var/lib/rabbitmq/
###################### rabbitmq end #####################
EOL
}

function env_php_public() {
  cat <<EOL
###################### php extensions ######################
# Available extensions:
#
# bcmath,bz2,calendar,curl,exif,ffmpeg,gd,gettext,gifsicle,git,gmp,imagick,
# imap,inotify,intl,jpegoptim,ldap,mbstring,mcrypt,mongodb,mysql,mysqli,
# opcache,optipng,pcntl,pdo_mysql,pdo_sqlsrv,phpcbf,phpcs,php-cs-fixer,phpmd,
# phpstan,pngquant,psalm,pspell,readline,redis,shmop,snmp,soap,sockets,sqlsrv,
# svgo,swoole,sysvmsg,sysvsem,sysvshm,tidy,wddx,webp,xhprof,xmlrpc,xsl,yaf,zip
#
# Please use commas(,) to separate them
#
# For other extensions not list here, you also can install
# Through pecl or source
# Through the php.sh script
###################### php extensions end ######################

###################### php start ########################
PHP_MACHINE_INI=./conf/php.ini
PHP_CONTAINER_INI=/usr/local/etc/php/php.ini
PHP_MACHINE_FPM_CONFIG=./conf/php-fpm.conf
PHP_CONTAINER_FPM_CONFIG=/usr/local/etc/php-fpm.d/www.conf
PHP_MACHINE_COMPOSER_DIR=~/.composer
PHP_CONTAINER_COMPOSER_DIR=/tmp/.composer
PHP_IMAGICK_VERSION=3.7.0
PHP_CODE_SNIFFER_VERSION=3.6.2
PHP_CS_FIXER_VERSION=3.8.0
PHP_PHPMD_VERSION=2.12.0
PHP_PHPSTAN_VERSION=1.5.4
PHP_PSALM_VERSION=4.22.0
PHP_SQLSRV_SOFTWARE_VERSION=18_18.0.1.1-1
######################php end##########################

EOL
}

function env_php56() {

  cat <<EOL
###################### php56 start ######################
PHP56_NAME=php56
PHP56_VERSION=5.6
PHP56_EXPOSE=9000
PHP56_EXTENSIONS=\${PHP_EXTENSIONS}
PHP56_MORE_EXTENSION_INSTALLERS=php56.sh
PHP56_INOTIFY_VERSION=0.1.6
PHP56_MCRYPT_VERSION=0
PHP56_MONGODB_VERSION=1.7.5
PHP56_REDIS_VERSION=4.3.0
PHP56_SQLSRV_VERSION=0
PHP56_SWOOLE_VERSION=2.0.11
PHP56_XHPROF_VERSION=0.9.4
PHP56_YAF_VERSION=2.3.5
###################### php56 end ########################
EOL
}

function env_php73() {

  cat <<EOL
###################### php73 start ######################
PHP73_NAME=php73
PHP73_VERSION=7.3
PHP73_EXPOSE=9000
PHP73_EXTENSIONS=\${PHP_EXTENSIONS}
PHP73_MORE_EXTENSION_INSTALLERS=php73.sh
PHP73_INOTIFY_VERSION=3.0.0
PHP73_MCRYPT_VERSION=1.0.4
PHP73_MONGODB_VERSION=1.13.0
PHP73_REDIS_VERSION=5.3.7
PHP73_SQLSRV_VERSION=5.10.0
PHP73_SWOOLE_VERSION=4.8.8
PHP73_XHPROF_VERSION=5.0.4
PHP73_YAF_VERSION=3.3.4
###################### php73 end ########################
EOL
}

function env_php74() {

  cat <<EOL
###################### php74 start ######################
PHP74_NAME=php74
PHP74_VERSION=7.4
PHP74_EXPOSE=9000
PHP74_EXTENSIONS=\${PHP_EXTENSIONS}
PHP74_MORE_EXTENSION_INSTALLERS=php74.sh
PHP74_INOTIFY_VERSION=3.0.0
PHP74_MCRYPT_VERSION=1.0.4
PHP74_MONGODB_VERSION=1.13.0
PHP74_REDIS_VERSION=5.3.7
PHP74_SQLSRV_VERSION=5.10.0
PHP74_SWOOLE_VERSION=4.8.8
PHP74_XHPROF_VERSION=5.0.4
PHP74_YAF_VERSION=3.3.4
###################### php74 end ########################
EOL
}

function env_php80() {

  cat <<EOL
###################### php80 start ######################
PHP80_NAME=php80
PHP80_VERSION=8.0
PHP80_EXPOSE=9000
PHP80_EXTENSIONS=\${PHP_EXTENSIONS}
PHP80_MORE_EXTENSION_INSTALLERS=php80.sh
PHP80_INOTIFY_VERSION=3.0.0
PHP80_MCRYPT_VERSION=1.0.4
PHP80_MONGODB_VERSION=1.13.0
PHP80_REDIS_VERSION=5.3.7
PHP80_SQLSRV_VERSION=5.10.0
PHP80_SWOOLE_VERSION=4.8.8
PHP80_XHPROF_VERSION=5.0.4
PHP80_YAF_VERSION=3.3.4
###################### php80 end ########################
EOL
}
